<?php

include('confdb.php');

$con = mysqli_connect($db_host, $db_user, $db_pass, $db_name);
$idvistuplenie = $_POST['idvistuplenie'] ?? '';
if(!$con) {

die ('Ошибка подключения: '.mysqli_connect_error());

} 
    
    $sql = "SELECT idvistuplenie FROM vistuplenie where vistuplenie_zaversheno=1 ORDER BY idvistuplenie DESC LIMIT 1";
    $result = mysqli_query($con, $sql);

    $idsav = mysqli_fetch_assoc($result)['idvistuplenie'];
    
    if($idvistuplenie == $idsav) {
        include('vistuplenie.php');
    } else { 
        $otvet['success'] = 0;
    }
    

echo json_encode($otvet);
 

?>

